const mysql = require('mysql2')

const connection = mysql.createConnection({
    'host': '127.0.0.1',
    'user': 'mydb',
    'password': 'mydb',
    'database': 'testmydb'
})
connection.connect()

//定义删除记录的SQL语句
var delSql = 'DELETE FROM bookinfo WHERE id = 13';
//通过查询命令执行删除操作
connection.query(delSql, function(err, result) {
    if (err) throw err;
    console.log('-------删除记录----------');
    console.log('删除的行数:', result.affectedRows);
});
connection.end();